//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing.Diagram
{
    class ConstraintRefAttributes
    {
        private ConstraintType _refType;
        private ConstraintRelationship _refFor;
        private string _refForName;
        private ElementType _refPtType;

        public void ReadXml (ReadContext c)
        {
            _refType = c.GetOptionalEnum("refType", ConstraintType.None);
            _refFor = c.GetOptionalEnum("refFor", ConstraintRelationship.Self);
            _refForName = c.GetOptionalString("refForName", string.Empty);
            _refPtType = c.GetOptionalEnum("refPtType", ElementType.All);
        }

        public void WriteXml(WriteContext c)
        {
            c.SetOptionalEnum("refType", _refType, ConstraintType.None);
            c.SetOptionalEnum("refFor", _refFor, ConstraintRelationship.Self);
            c.SetOptionalString("refForName", _refForName, string.Empty);
            c.SetOptionalEnum("refPtType", _refPtType, ElementType.All);
        }
    }
}